﻿using MengLin.OOP.DesignPattern.ETS.Evaluator.Abstract;
using MengLin.OOP.DesignPattern.ETS.Evaluator.Implements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.ETC.ScoringTree.Abstract
{
    /// <summary>
    /// 评分树
    /// </summary>
    public class MyScoringTreeApp:ScoringTreeApp
    {
        /// <summary>
        /// 构建角色树
        /// 把对象组合起来
        /// </summary>
        /// <returns></returns>
        public override AbstractEvaluator BuildTree()
        {
            #region Addition加法
            AbstractEvaluator carryEvaluator = new CarryFeatureLeaf()
            {
                Name = "Carry考察"
            };
            AbstractEvaluator propertiesEvaluator = new PropertiesFeatureLeaf()
            {
                Name = "Properties考察"
            };
            FeatureGroup featureGroupAddition = new FeatureGroup("Addition");
            //添加评分器
            featureGroupAddition.AddEvaluator(carryEvaluator, 2);//Carry
            featureGroupAddition.AddEvaluator(propertiesEvaluator, 1);//Properties
            #endregion

            #region Subtraction减法
            AbstractEvaluator borrowEvaluator1 = new BorrowFeatureLeaf()
            {
                Name = "Borrow考察"
            };
            AbstractEvaluator properties2Evaluator = new Properties2FeatureLeaf()
            {
                Name = "Properties2考察"
            };
            FeatureGroup featureGroupSubtraction = new FeatureGroup("Subtraction");
            //添加评分器
            featureGroupSubtraction.AddEvaluator(borrowEvaluator1, 2);//Borrow
            featureGroupSubtraction.AddEvaluator(properties2Evaluator, 1);//Properties2
            #endregion

            #region Terms
            FeatureGroup termsFeatureGroup = new FeatureGroup("Terms");
            //添加评分器
            termsFeatureGroup.AddEvaluator(featureGroupSubtraction, 2);//Subtraction减法
            termsFeatureGroup.AddEvaluator(featureGroupAddition, 2);//Addition加法
            #endregion

            return termsFeatureGroup;
        }
    }
}
